#ifndef GAMEAREA_H
#define GAMEAREA_H

#include <QWidget>
#include <QVector>
#include <QPoint>
#include "food.h"

class GameArea : public QWidget
{
    Q_OBJECT

public:
    GameArea(QWidget *parent = nullptr);

protected:
    void paintEvent(QPaintEvent *event) override;
    void timerEvent(QTimerEvent *event) override;
    void keyPressEvent(QKeyEvent *event) override;

private:
    void moveSnake();
    void checkCollision();
    void generateFood();

    QVector<QPoint> snake;
    QPoint direction;
    Food food;
    int timerId;
};

#endif // GAMEAREA_H
